package com.fr.privilege.ui;

import com.fr.base.StringUtils;
import com.fr.base.core.util.TemplateUtils;
import com.fr.web.core.WebUtils;
import com.fr.web.platform.PlatformUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class NullLoginoutUI extends LoginoutUI
{
  public String createURL(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, String paramString)
    throws Exception
  {
    HttpSession localHttpSession = paramHttpServletRequest.getSession(true);
    if (StringUtils.isNotEmpty(paramString))
      localHttpSession.setAttribute("fr_error", paramString);
    localHttpSession.setAttribute("fr_from", WebUtils.getOriginalURL(paramHttpServletRequest));
    return TemplateUtils.render("${servletURL}?op=auth_login", WebUtils.createTemplateMap(paramHttpServletRequest));
  }

  public void redirect2LoginUI(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, String paramString)
    throws Exception
  {
    PlatformUtils.redirect(paramHttpServletResponse, createURL(paramHttpServletRequest, paramHttpServletResponse, paramString));
  }
}